﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Net.Security;

namespace SlamCms.SharePointServices.Authentication
{
	[ServiceContract]
	internal interface IWSTrust13Contract
	{
		[OperationContract(ProtectionLevel = ProtectionLevel.EncryptAndSign, Action = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue", ReplyAction = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTRC/IssueFinal", AsyncPattern = true)]
		IAsyncResult BeginIssue(System.ServiceModel.Channels.Message request, AsyncCallback callback, object state);
		System.ServiceModel.Channels.Message EndIssue(IAsyncResult asyncResult);
	}

	internal class WSTrust13ContractClient : ClientBase<IWSTrust13Contract>, IWSTrust13Contract
	{
		public WSTrust13ContractClient(Binding binding, EndpointAddress remoteAddress)
			: base(binding, remoteAddress)
		{
		}

		public IAsyncResult BeginIssue(Message request, AsyncCallback callback, object state)
		{
			return base.Channel.BeginIssue(request, callback, state);
		}

		public Message EndIssue(IAsyncResult asyncResult)
		{
			return base.Channel.EndIssue(asyncResult);
		}
	}
}
